// Table 1: Table 1: Top 10 Most and Least Important Characteristics

ssc install texsave

use "Data_ImportantProvisions_240423.dta", clear


************************************Table with top 10 and lower 10************************************
egen mean_total = rowmean(mean_general mean_func_democ mean_new_democ mean_divided_democ)


egen sd_general = rowsd(general*num)
egen sd_func_democ = rowsd(func_democ*num)
egen sd_new_democ = rowsd(new_democ*num)
egen sd_divided_democ = rowsd(divided_democ*num)
egen agreement_total = rowmean(sd_general sd_func_democ sd_new_democ sd_divided_democ)



replace mean_general = round(mean_general, 0.01)
replace sd_general = round(sd_general, 0.01)
 
ren lab Provision
ren mean_total Mean_Importance
ren agreement_total Disagreement
 
*Top Panel: "Most Important Provisions"
gsort Disagreement
br Provision Mean_Importance Disagreement if _n <= 15

texsave Provision Mean_Importance Disagreement if _n <= 15 using "Table_1_top.tex", replace
 
 
*Bottom Panel: "Least Important Provisions"
gsort -Disagreement
br Provision Mean_Importance Disagreement if _n <= 13
texsave Provision Mean_Importance Disagreement if _n <= 13 using "Table_1_bottom.tex", replace

